#!/bin/bash
#build and install gmssl,build test tools
. /opt/hygon/common.sh

os_release=$(eval get_os_release)

case $os_release in
     "centos")
                source /opt/rh/devtoolset-8/enable
                ;;
     "kylin")
                git config --global --add safe.directory /opt/hygon/csv/GmSSL
                ;;
     esac


cd GmSSL
git checkout GmSSL-v2
git checkout 5b904768
sed -i "s/qw\/glob/qw\/:glob/g" Configure
sed -i "s/qw\/glob/qw\/:glob/g" test/build.info
./config --prefix=/opt/gmssl
make && sudo make install

cd /opt/hygon/csv/attestation
make
cd /opt/hygon/csv/sme_test
make
cd /opt/hygon/csv/csv2-reg-test
make
cd /opt/hygon/csv/pek_oca
make
cd /opt/hygon/csv/csv3-memory-rw-test/csv3_test
make
cd /opt/hygon/csv/csv3-memory-rw-test/host-module
make
